﻿// JavaScript Document
/*
这个脚本控制调试相关功能，如果不需要显示调试信息则无需加载此脚本。

                                      Noah～～
									  文档最后修改日期：2011-02-28
*/

//var debug_mode_state=0;

//不要再外部做 var video_debuger=document.getElementById(html5_player_video_id); 这类操作，否则新加载的媒体无法获取状态，必须放到setinterval里面才能保证得到新的媒体元素。
//var audio_debuger=document.getElementById(html5_player_audio_id);

function debug_media(id,show_place)
{

	 var debuger=window.setInterval(function(){
	 var v=document.getElementById(id);
	  var d="";
	  d+="currentTime:"+v.currentTime+"<br>";
	  d+="error.code:"+v.error+"<br>";
	  d+="currentSrc:"+v.currentSrc+"<br>";
	  d+="networkState:"+v.networkState+"<br>";
	  d+="buffered:"+v.buffered+"<br>";
	  d+="readyState:"+v.readyState+"<br>";
	  d+="seeking:"+v.seeking+"<br>";
	  d+="seekable:"+v.seekable+"<br>";
	  d+="duration:"+v.duration+"<br>";
	  d+="played:"+v.played+"<br>";
	  d+="defaultPlaybackRate:"+v.defaultPlaybackRate+"<br>";
	  d+="playbackRate:"+v.playbackRate+"<br>";
	  d+="volume:"+v.volume+"<br>";
	  d+="muted:"+v.muted+"<br>";
	  d+="width:"+v.width+"<br>";
	  d+="height:"+v.height+"<br>";
  //	d+="defaultPlaybackRate:"+v.defaultPlaybackRate+"<br>"
  //	d+="defaultPlaybackRate:"+v.defaultPlaybackRate+"<br>"
	  document.getElementById(show_place).innerHTML=d;
	  },1000);
	  return debuger;
  }

function debug_mode()
{
	if(html5_player_debug_mode==0)//如果当前为关则开启
	{
		//var temp=document.getElementById(html5_player_video_id)
     audio_debug=debug_media(html5_player_audio_id,html5_player_debug_audio_information_id);
	 video_debug=debug_media(html5_player_video_id,html5_player_debug_video_information_id);
	 html5_player_debug_mode=1;
	 document.getElementById(html5_player_debug_button_id).innerHTML="关闭";
	}
	  else
	  {
	 audio_debug=window.clearInterval(audio_debug);
     video_debug=window.clearInterval(video_debug);
	 document.getElementById(html5_player_debug_audio_information_id).innerHTML="";
	 document.getElementById(html5_player_debug_video_information_id).innerHTML="";
	  html5_player_debug_mode=0;
	  document.getElementById(html5_player_debug_button_id).innerHTML="开启";
		  }
}
